
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import store from'./store/store.js'

// 导入网络请求的包
import { REQUEST, transformRequestResponseOkData } from 'miniprogram-request';
// 请求的根路径
// REQUEST.Defaults.baseURL = 'https://www.uinav.com'
REQUEST.Defaults.baseURL = 'https://api-hmugo-web.itheima.net'

// 自动提取返回值为 2xx 时的 `response.data`
REQUEST.Defaults.transformResponse = transformRequestResponseOkData;

uni.$http = REQUEST;

// 添加监听时间 可选
 // REQUEST.Listeners.onResponse.push(console.log); // 记录每次响应
 
 // 封装弹框方法
 uni.$showMsg = function(title = '数据请求失败', duration = 1500){
   uni.showToast({
     title,
     duration,
     icon: 'none'
   })
 } 

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
    ...App,
    store
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif